/*
 * SFTPClient.h
 *
 *  Created on: Apr 10, 2011
 *      Author: sms103
 */

#ifndef SFTPCLIENT_H_
#define SFTPCLIENT_H_

class SFTPClient;

#include "../networklib/SFTPConnection.h"
#include "../networklib/IPAddress.h"
#include "../networklib/FileTransporter.h"
#include <string>
#include <list>
#include <stdint.h>

#include "SFTPClientListener.h"


#define DEFAULT_CLIENT_PARAM_FILE_NAME  "SFTP_CLIENT_PARAMS.config"

class SFTPClient {
public:
	SFTPClient(const char *paramFileName);

	bool connectToServer(string hostname);
	bool connectToServer(string ipstr, int port);

	bool putFile(string localFileName,string remoteFileName);

	bool getFile(string localFileName, string remoteFileName);

	bool listRemoteDir(string remotePathName,string& contents);

	void disconnect();

	virtual ~SFTPClient();

	//config file parameter parser
	ParamParser *paramParser;

	SFTPClientListener *listener;


private:

	void setParams();
	IPAddress serverAddr;
	int serverPort;

	SFTPConnection * ctrlConnection;
	SFTPConnection * dataConnection;
	bool connected;
	uint32_t sessionID;
	FileTransporter * fileTransporter;

	SFTPMessage *msg;
	string nsrootFile;
};

#endif /* SFTPCLIENT_H_ */
